package conMgr.model;

import java.util.List;
import java.util.Observable;

public class Review extends Observable
{
	/**
	 * The comment to Author.
	 */
	private String commentsForAuthor;
	
	/**
	 * The comment for Subprogram Chair.
	 */
	private String commentsForSpChair;
	
	/**
	 * The rating of this paper.
	 */
	private List<Integer> rating;
	
	/**
	 * The overall rating of this paper.
	 */
	private Integer overallRatings;
	
	/**
	 * True if submitted.
	 */
	private boolean isSubmitted;
	
	/**
	 * The paper
	 */
	private Paper my_paper;
	
	/**
	 * User's type
	 */
	private UserType type;
	
	/**
	 * The user
	 */
	private User my_user;
	
	/**
	 * Constructor for a review.
	 * @param reviewer
	 * @param paper
	 */
	public Review(User reviewer, Paper paper)
	{
		my_user = reviewer;
		type = UserType.REVIEWER;
		my_paper = paper;
		
		reviewer.getUserReviews().add(this);
		paper.getPaperReviews().add(this);
	}
	
	/**
	 * 
	 * @return my_user
	 */
	public User getReviewer()
	{		
		return my_user ;
	}
	
	/**
	 * 
	 * @return my_paper
	 */
	public Paper getPaper()
	{
		return my_paper;
	}
	
	/**
	 * 
	 * @return type of this user.
	 */
	public UserType getType()
	{
		return this.type;
	}
	
	/**
	 * 
	 * @return boolean whether this paper is submitted or not.
	 */
	public boolean getIsSubmitted()
	{
		
		return this.isSubmitted;
	}
	
	/**
	 * 
	 * @param commentsForAuthor
	 * @param commentsForSubprogramChair
	 * @param ratings
	 * @param overallRating
	 */
	public void submitToSubprogramChair
	(
		String commentsForAuthor,
		String commentsForSubprogramChair,
		List<Integer> ratings,
		Integer overallRating
	)
	{
		this.commentsForAuthor = commentsForAuthor;
		this.commentsForSpChair = commentsForSubprogramChair;
		this.rating = ratings;
		this.overallRatings = overallRating;
		isSubmitted = true;
		notifyObservers();
	}
	
	/**
	 * 
	 * @return comments for the author.
	 */
	public String getcommentsForAuthor()
	{
		return this.commentsForAuthor;
	}
	
	/**
	 * 
	 * @return comments for the subprogram chair.
	 */
	public String getcommentsForSpChair()
	{
		return this.commentsForSpChair;
	}
	
	/**
	 * 
	 * @return list of ratings
	 */
	public List<Integer> getRating()
	{
		return this.rating;
	}
	
	/**
	 * 
	 * @return overall rating.
	 */
	public Integer getOverallRatings()
	{
		return this.overallRatings;
	}
}
